//index.js
//获取应用实例
const app = getApp()

Page({
  data: {
    type:'',
  },
  //事件处理函数
  bindViewTap: function() {
    wx.navigateTo({
      url: '../logs/logs'
    })
  },

  onLoad: function () {
    var type = wx.getStorageSync('type');
  
    if(!type){
        wx.redirectTo({url: '/pages/select/select', })
    }
    this.setData({
      type:type
    })
  },
 
  //科目一试题库
  goQuestion1Page:function(){
      wx.navigateTo({url: '/pages/question1/question1',})
  },
  goQuestion4Page: function () {
    wx.navigateTo({ url: '/pages/question4/question4', })
  },
  goTest1Page:function(){
    wx.navigateTo({ url: '/pages/test1/test1', })
  },
  goTest4Page:function(){
    wx.navigateTo({ url: '/pages/test4/test4', })
  },
  geSelect:function(){
    var type = wx.getStorageSync('type');
    wx.removeStorageSync('type');
    wx.removeStorageSync(type + '_question_list_1');
    wx.removeStorageSync(type + '_question_list_4');
    wx.removeStorageSync(type + '_test_4');
    wx.removeStorageSync(type + '_test_1');
    wx.removeStorageSync(type + '_number_test_1');
    wx.removeStorageSync(type + '_number_test_4');
    wx.removeStorageSync(type + '_number_1');
    wx.removeStorageSync(type + '_number_4');

    wx.reLaunch({
      url: '/pages/select/select',
    })
  }
})
